/* util */
import http from '@src/util/http'

let prefix = '/api/app/outside/email';

/** 
 * @description 编辑配置
 */
export function submit(params = {}) {
  return http.post(`${prefix}/config/submit`, params)
}

/** 
 * @description 获取租户邮件配置
 */
export function emailConfig(params = {}) {
  return http.get(`${prefix}/emailConfig`, params)
}
  
/** 
 * @description 邮件发送测试
 */
export function testSend(params = {}) {
  return http.post(`${prefix}/testSend`, params)
}

/** 
 * @description 删除租户配置
 */
export function delConfig(params = {}) {
  return http.post(`${prefix}/delConfig`, params)
}   

/** 
 * @description 获取配置页相关配置信息
 */
export function getMailSettingConfig(params = {}) {
  return http.get('/setting/email/getMailSetting', params)
}

/** 
 * @description 编辑配置页相关配置信息
 */
export function saveSetting(params = {}) {
  return http.post('/setting/email/saveSetting', params)
}


/** 
 * @description 编辑邮件模板
 */
export function change(params = {}) {
  return http.post(`${prefix}/template/change`, params)
}

/**
 * @description 邮件记录
 * @param {Object} params - 参数
 */
export function getRecords(params: {} | undefined) {
  return http.post('/api/app/outside/email/mailSearch', params)
}

/**
 * @description 邮件详情
 * @param {Object} params - 参数
 */
export function getEmailDetail(params: {} | undefined) {
  return http.get('/api/app/outside/email/emailDetail', params)
}

/**
 * @description 查询邮件事件分享配置
 * @param {Object} params - 参数
 */
 export function getMailSetting(params: {} | undefined) {
  return http.get('/setting/email/getMailSetting/type', params)
}

/** 
 * @description 获取邮件模板
 */
export function getTemplate(params = {}) {
  return http.get(`${prefix}/getTemplate`, params)
}  

/** 
 * @description 配置页获取自定义字段
 */
export function getTemplateField(params = {}) {
  return http.get(`${prefix}/getTemplateField`, params)
}
